<template>
  <div class="table">
    <!-- <el-table :data="data" style="width: 100%" border>
      <el-table-column prop="date" label="时间" align="center" width="150" />
      <el-table-column prop="name" label="物品" align="center" />
      <el-table-column prop="number" label="数量" align="center" />
      <el-table-column prop="price" label="金额" align="center" />
    </el-table> -->

    <div class="table-head">
      <div v-for="(item, index) in headers" :key="index" class="head-item">
        {{ item }}
      </div>
    </div>
    <div class="table-body">
      <div v-for="item in data" :key="item.id" class="row">
        <div class="cell">{{ item.date }}</div>
        <div class="cell">{{ item.name }}</div>
        <div class="cell">{{ item.number }}</div>
        <div class="cell">{{ item.price }}</div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  props: {
    data: {
      type: Array,
      required: true
    }
  },
  data() {
    return {
      headers: ['时间', '物品', '数量', '金额']
    }
  }
}
</script>
<style lang="scss" scoped>
.table {
  border: 1px solid #33416b;
  .table-head {
    display: flex;
    font-size: 14px;
    color: #9aa8d4;
    justify-content: space-evenly;
    height: 40px;
    line-height: 40px;
    border-bottom: 1px solid #33416b;

    .head-item {
      width: 25%;
      text-align: center;
    }
  }

  .table-body {
    color: #9aa8d4;
    .row {
      display: flex;
      border-bottom: 1px solid #33416b;
      font-size: 13px;
      &:last-child {
        border-bottom: none;
      }

      .cell {
        width: 25%;
        text-align: center;
        padding: 14px 0;
      }
    }
  }
}
</style>
